<template>
  <div class="user-home-container">
    <!-- 添加Header组件 -->
    <Header />
    
    <!-- 新设计的标题栏 - 参照企业端样式 -->
    <header class="header">
      <div class="header-container">
        <!-- Logo和标题 -->
        <div class="logo-section">
          <img src="../../assets/images/login/logo2.png" class="logo-image" />
          <span class="logo-text">{{ $t('userHome.pageTitle') }}</span>
        </div>
        
        <!-- 导航菜单 -->
        <nav class="nav-menu">
          <div class="nav-item" :class="{ active: activeNav === 'home' }" @click="goToHome">{{ $t('userHome.home') }}</div>
          <div class="nav-item" :class="{ active: activeNav === 'demand' }" @click="goToDemandLibrary">{{ $t('userHome.demandLibrary') }}</div>
          <div class="nav-item" :class="{ active: activeNav === 'applications' }" @click="goToApplicationRecords">{{ $t('userHome.applicationRecords') }}</div>
        </nav>
        
        <!-- 右侧用户区域 -->
        <div class="header-buttons">
          <!-- 语言切换按钮 -->
          <div class="language-switch">
            <el-dropdown @command="changeLanguage" trigger="hover" placement="bottom-end">
              <button class="language-dropdown-btn">
                <el-icon class="globe-icon">
                  <svg viewBox="0 0 24 24" fill="currentColor">
                    <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.94-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z"/>
                  </svg>
                </el-icon>
                <span class="current-lang">{{ currentLanguage === 'zh' ? '中文' : 'English' }}</span>
                <el-icon class="arrow-icon">
                  <ArrowDown />
                </el-icon>
              </button>
              <template #dropdown>
                <el-dropdown-menu>
                  <el-dropdown-item 
                    command="zh" 
                    :class="{ 'is-active': currentLanguage === 'zh' }"
                  >
                    <div class="lang-option">
                      <span class="lang-flag">🇨🇳</span>
                      <span class="lang-text">中文</span>
                      <el-icon v-if="currentLanguage === 'zh'" class="check-icon">
                        <Check />
                      </el-icon>
                    </div>
                  </el-dropdown-item>
                  <el-dropdown-item 
                    command="en" 
                    :class="{ 'is-active': currentLanguage === 'en' }"
                  >
                    <div class="lang-option">
                      <span class="lang-flag">🇺🇸</span>
                      <span class="lang-text">English</span>
                      <el-icon v-if="currentLanguage === 'en'" class="check-icon">
                        <Check />
                      </el-icon>
                    </div>
                  </el-dropdown-item>
                </el-dropdown-menu>
              </template>
            </el-dropdown>
          </div>
          
          <!-- 登录状态下显示用户操作按钮 -->
          <div class="user-actions">
            <el-icon class="notification-bell" size="20" @click="goToNotifications"><Bell /></el-icon>
            <span class="action-item" @click="handleDropdownCommand('user-center')">{{ $t('userCenter') }}</span>
            <span class="action-item" @click="handleDropdownCommand('logout')">{{ $t('userHome.logout') }}</span>
          </div>
        </div>
      </div>
    </header>

    <!-- 企业端主横幅区域 -->
    <section class="hero-section">
      <!-- 轮播图背景 -->
      <div class="banner-carousel" v-if="!bannerLoading && !bannerError && bannerImages.length > 0">
        <div class="banner-slide" 
          v-for="(banner, index) in bannerImages" 
          :key="index"
          :class="{ active: currentBannerIndex === index }"
          :style="{ backgroundImage: `url(${banner})` }">
        </div>
        <!-- 轮播指示器 -->
        <div class="banner-indicators" v-if="bannerImages.length > 1">
          <div 
            v-for="(banner, index) in bannerImages" 
            :key="index"
            class="banner-indicator"
            :class="{ active: currentBannerIndex === index }"
            @click="goToBannerSlide(index)">
          </div>
        </div>
      </div>
      
      <!-- 整个轮播图区域的蒙版 -->
      <div class="hero-overlay"></div>
      
      <!-- 加载状态 -->
      <div class="banner-loading" v-if="bannerLoading">
        <el-icon class="loading-icon"><Loading /></el-icon>
      </div>
      
      <!-- 无轮播图时的提示 -->
      <div class="no-banner-message" v-if="!bannerLoading && !bannerError && bannerImages.length === 0">
        <p>暂无轮播图数据</p>
      </div>
      
      <div class="hero-content">
        <!-- 主标题图片 -->
        <div class="hero-title">
          <img
            class="title-image"
            :alt="$t('userHome.heroImageAlt')"
            src="@/assets/images/login/首页字体.png"
          />
        </div>
        
        <!-- 搜索框 -->
        <div class="search-container">
          <div class="search-box">
            <el-input
              v-model="searchKeyword"
              class="search-input"
              :placeholder="$t('userHome.searchPlaceholder')"
              size="large"
              @keyup.enter="handleSearch"
            />
            <el-button 
              type="primary" 
              circle
              class="search-button"
              @click="handleSearch"
            >
              <el-icon><Search /></el-icon>
            </el-button>
          </div>
        </div>
      </div>
    </section>

    
    <!-- 连接世界成就未来区域 -->
    <section class="mission-section">
      <div class="mission-container">
        <h2 class="mission-title">
          {{ $t('userHome.missionTitle') }}
        </h2>
        
        <p class="mission-subtitle">
          {{ $t('userHome.missionSubtitle') }}
        </p>
        
        <p class="mission-description">
          {{ $t('userHome.missionDescription') }}
        </p>
        
        </div>
    </section>

    <!-- 服务特色区域 -->
    <section class="service-features-section">
      <div class="service-features-container">
        <div class="service-cards-grid">
          <!-- 国际人才培养卡片 -->
          <div class="service-card talent-card">
            <div class="card-background">
              <img src="@/assets/images/effects/图1.jpg" alt="国际人才培养" class="card-image" />
            </div>
            <div class="card-overlay"></div>
            <div class="card-content">
              <h3 class="card-title vertical-text">{{ $t('userHome.talentDevelopment') }}</h3>
              <p class="card-description">
                {{ $t('userHome.talentDevelopmentDesc') }}
              </p>
              </div>
              </div>

          <!-- 跨境资源对接卡片 -->
          <div class="service-card resource-card">
            <div class="card-background">
              <img src="@/assets/images/effects/图2.png" alt="跨境资源对接" class="card-image" />
            </div>
            <div class="card-overlay"></div>
            <div class="card-content">
              <h3 class="card-title vertical-text">{{ $t('userHome.resourceConnection') }}</h3>
              <div class="card-icon">
                <div class="shield-icon"></div>
              </div>
              </div>
              </div>

          <!-- 专业服务保障卡片 -->
          <div class="service-card service-card-wide">
            <div class="card-background">
              <img src="@/assets/images/effects/图3.jpg" alt="专业服务保障" class="card-image" />
            </div>
            <div class="card-overlay"></div>
            <div class="card-content">
              <h3 class="card-title vertical-text">{{ $t('userHome.serviceGuarantee') }}</h3>
              </div>
              </div>

          <!-- 安全隐私保护卡片 -->
          <div class="service-card security-card">
            <div class="card-background">
              <img src="@/assets/images/effects/图4.png" alt="安全隐私保护" class="card-image" />
            </div>
            <div class="card-overlay"></div>
            <div class="card-content">
              <h3 class="card-title vertical-text">{{ $t('userHome.privacyProtection') }}</h3>
            </div>
          </div>
        </div>
      </div>
    </section>
    
    <!-- 发现国际精英介绍区域 -->
    <section class="discover-talent-section">
      <div class="discover-container">
        <div class="discover-content">
          <h2 class="discover-title">
            {{ $t('userHome.globalDemandHubTitle') }}
          </h2>
          
          <div class="discover-description">
            <p class="desc-text">{{ $t('userHome.globalDemandHubDesc') }}</p>
          </div>
        
          <div class="discover-action">
            <el-button 
              type="primary" 
              size="large"
              class="discover-btn"
              @click="enterDemandHub"
            >
              {{ $t('userHome.enterDemandHub') }}
              <el-icon class="ml-2"><ArrowRight /></el-icon>
            </el-button>
          </div>
        </div>
      </div>
    </section>

    <!-- 我们的文化区域 -->
    <section class="our-culture-section">
      <div class="culture-container">
        <div class="culture-layout">
          <!-- 左侧文字内容 -->
          <div class="culture-content">
            <h2 class="culture-title">
              {{ $t('userHome.talentProfileTitle1') }}<span class="highlight-purple">{{ $t('userHome.talentProfileTitle2') }}</span>
            </h2>
            
            <div class="culture-description">
              <p class="culture-text">{{ $t('userHome.talentProfileDesc') }}</p>
            </div>
            
            <div class="culture-action">
              <el-button 
                type="primary" 
                size="large"
                class="culture-btn"
                @click="customizeTalentNeeds"
              >
                {{ $t('userHome.customizeTalentNeeds') }}
              </el-button>
            </div>
            </div>
            
          <!-- 右侧图片网格 -->
          <div class="culture-images">
            <div class="images-grid">
              <div class="image-item image-1">
                <img src="@/assets/images/effects/团队1.jpg" :alt="$t('userHome.teamCulture1')" class="team-image" />
              </div>
              <div class="image-item image-2">
                <img src="@/assets/images/effects/团队2.jpeg" :alt="$t('userHome.teamCulture2')" class="team-image" />
              </div>
              <div class="image-item image-3">
                <img src="@/assets/images/effects/团队3.jpg" :alt="$t('userHome.teamCulture3')" class="team-image" />
              </div>
              <div class="image-item image-4">
                <img src="@/assets/images/effects/团队4.jpg" :alt="$t('userHome.teamCulture4')" class="team-image" />
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>

    <!-- 我们的承诺区域 -->
    <section class="our-promise-section">
      <div class="promise-container">
        <h2 class="promise-title">{{ $t('userHome.promiseTitle') }}</h2>
        
        <div class="promise-content">
          <p class="promise-text">
            {{ $t('userHome.promiseText1') }}
          </p>
          <p class="promise-text">
            {{ $t('userHome.promiseText2') }}
          </p>
          <p class="promise-text">
            {{ $t('userHome.promiseText3') }}
          </p>
          
          <p class="promise-highlight">
            {{ $t('userHome.promiseHighlight') }}
                </p>
              </div>
      </div>
    </section>

    <!-- Footer区域 -->
    <footer class="main-footer">
      <div class="footer-container">
        <div class="footer-content">
          <!-- 左侧：社交媒体和版权信息 -->
          <div class="footer-left">
            <div class="social-section">
              <p class="follow-text">{{ $t('userHome.followUs') }}</p>
              <div class="social-links">
                <a href="#" class="social-link tiktok" @click.prevent="openSocialMedia('tiktok')">
                  <img src="@/assets/images/effects/图标1.png" alt="TikTok" class="social-icon-img" />
                </a>
                <a href="#" class="social-link wechat" @click.prevent="openSocialMedia('wechat')">
                  <img src="@/assets/images/effects/图标2.png" alt="WeChat" class="social-icon-img" />
                </a>
                <a href="#" class="social-link weibo" @click.prevent="openSocialMedia('weibo')">
                  <img src="@/assets/images/effects/图标3.png" alt="Weibo" class="social-icon-img" />
                </a>
                <a href="#" class="social-link qq" @click.prevent="openSocialMedia('qq')">
                  <img src="@/assets/images/effects/图标4.png" alt="QQ" class="social-icon-img" />
                </a>
            </div>
          </div>
          
            <div class="copyright-section">
              <div class="copyright-info">
                <span class="copyright-icon">🔒</span>
                <span class="copyright-text">{{ $t('userHome.copyright') }}</span>
              </div>
              </div>
            </div>
            
          <!-- 中间：联系我们 -->
          <div class="footer-center">
            <h4 class="contact-title">{{ $t('userHome.contactUs') }}</h4>
              </div>
          
          <!-- 右侧：按钮、导航链接和回到顶部 -->
          <div class="footer-right">
            <div class="footer-buttons">
              <el-button 
                class="footer-btn"
                @click="downloadApp"
              >
                {{ $t('userHome.wechatMiniProgram') }}
              </el-button>
              <el-button 
                class="footer-btn"
                @click="visitOfficialWebsite"
              >
                {{ $t('userHome.officialWebsite') }}
              </el-button>
            </div>
            
            <div class="sites-section">
              <h4 class="sites-title">{{ $t('userHome.relatedSites') }}</h4>
              <div class="nav-links">
                <a href="#" @click.prevent="goToPage('enterprise')" class="nav-link">{{ $t('userHome.enterprise') }}</a>
                <a href="#" @click.prevent="goToPage('student')" class="nav-link">{{ $t('userHome.student') }}</a>
                <a href="#" @click.prevent="goToPage('about')" class="nav-link">{{ $t('userHome.about') }}</a>
                <a href="#" @click.prevent="goToPage('talent')" class="nav-link">{{ $t('userHome.talentPool') }}</a>
              </div>
            </div>
            
            <div class="back-to-top" @click="scrollToTop">
              <el-icon><ArrowUp /></el-icon>
              </div>
              </div>
            </div>
          </div>
    </footer>

    <!-- 公告详情弹窗 -->
    <el-dialog
      v-model="showDetailDialog"
      :title="selectedAnnouncement?.title"
      width="80%"
      max-width="800px"
    >
      <div v-if="selectedAnnouncement" class="announcement-detail">
        <div class="detail-header">
          <img :src="selectedAnnouncement.image" :alt="selectedAnnouncement.title" class="detail-image" />
          <h3 class="detail-title">{{ selectedAnnouncement.fullTitle }}</h3>
        </div>

        <div class="detail-content">
          <div v-html="selectedAnnouncement.fullContent"></div>
      </div>

        <div class="detail-actions">
          <el-button type="primary" @click="applyNow(selectedAnnouncement)">
            {{ $t('userHome.applyNow') }}
          </el-button>
          <el-button @click="showDetailDialog = false">
            {{ $t('common.close') }}
          </el-button>
        </div>
      </div>
    </el-dialog>
  </div>
</template>

<script setup>
import { ref, computed, onMounted, onUnmounted } from 'vue'
import { useRouter } from 'vue-router'
import { useI18n } from 'vue-i18n'
import { ElMessage } from 'element-plus'
import { Search, ArrowRight, ArrowUp, ArrowDown, Loading, Bell, Check } from '@element-plus/icons-vue'
import axios from 'axios'
import Header from '../../components/layout/Header.vue'
import request, { TokenManager } from '@/utils/request'
import config from '@/config'

const router = useRouter()
const { t, locale } = useI18n()

// 导航状态
const activeNav = ref('home')

// 语言切换
const currentLanguage = ref(localStorage.getItem('lang') || 'zh')

// 语言切换方法
const changeLanguage = (lang) => {
  if (['zh', 'en'].includes(lang)) {
    locale.value = lang
    currentLanguage.value = lang
    localStorage.setItem('lang', lang)
    
    // 触发自定义事件，通知其他组件语言已改变
    window.dispatchEvent(new CustomEvent('languageChanged', { 
      detail: { language: lang } 
    }))
  }
}

// 企业端数据
const searchKeyword = ref('')
const showDetailDialog = ref(false)
const selectedAnnouncement = ref(null)

// 轮播控制
const currentIndex = ref(0)
const cardWidth = ref(800)
const cardGap = ref(40)
let autoPlayTimer = null

// 人才轮播控制
const talentCurrentIndex = ref(0)
const talentCardWidth = ref(150)
let talentAutoPlayTimer = null
const centerIndex = ref(3)
const visibleCount = 7

// 公告数据
const announcements = ref([
  {
    id: 1,
    title: '华为 | 数学与通信底层算法突破计划',
    description: '为突破香农极限理论瓶颈，华为中央研究院面向全球招募数学与算法天才青年（23-28岁），主攻6G通信、光子拓扑加密、高维信号编解码等"无人区"技术。',
    image: '/src/assets/images/effects/公告2.jpeg',
    fullTitle: '【天才招募】华为2024「数学π计划」启动！年薪201万+，攻克5.5G通信底层极限',
    fullContent: `<div class="announcement-full-content"><h4>核心内容：</h4><p>为突破香农极限理论瓶颈，华为中央研究院面向全球招募数学与算法天才青年（23-28岁），主攻6G通信、光子拓扑加密、高维信号编解码等"无人区"技术。</p></div>`
  },
  {
    id: 2,
    title: '字节跳动 | TikTok全球化合规攻坚组',
    description: '应对欧盟DSA法案、美国州级隐私诉讼、东南亚数据本地化政策，建立10亿级用户实时防护体系。',
    image: '/src/assets/images/effects/公告1.jpg',
    fullTitle: '【紧急部署】字节跳动TikTok电商招募全球数据合规官！首年期权价值超百万美金',
    fullContent: `<div class="announcement-full-content"><h4>核心痛点解决方案：</h4><p>应对欧盟DSA法案、美国州级隐私诉讼、东南亚数据本地化政策，建立10亿级用户实时防护体系。</p></div>`
  },
  {
    id: 3,
    title: '比亚迪 | 高端车型「仰望」全栈研发军团',
    description: '为突破百万豪车技术封锁，实现三电系统（CTB+800V Sic）+智能座舱（天神之眼4.0）全栈自研。',
    image: '/src/assets/images/effects/公告3.jpg',
    fullTitle: '【技术总攻】比亚迪「仰望」超电团队千人扩编！全栈汽车工程师年薪90万+',
    fullContent: `<div class="announcement-full-content"><h4>攻坚任务书：</h4><p>为突破百万豪车技术封锁，实现三电系统（CTB+800V Sic）+智能座舱（天神之眼4.0）全栈自研。</p></div>`
  }
])

// 人才数据
const talents = ref([
  {
    id: 1,
    name: '张明',
    image: '/src/assets/images/login/1.png',
    bgColor: '#E8D5B7'
  },
  {
    id: 2,
    name: '李华',
    image: '/src/assets/images/login/2.jpg',
    bgColor: '#F5F5F5'
  },
  {
    id: 3,
    name: '王强',
    image: '/src/assets/images/login/3.jpg',
    bgColor: '#FF8C00'
  },
  {
    id: 4,
    name: '刘洋',
    image: '/src/assets/images/login/4.jpg',
    bgColor: '#E6E6FA'
  },
  {
    id: 5,
    name: '陈红',
    image: '/src/assets/images/login/5.jpg',
    bgColor: '#20B2AA'
  },
  {
    id: 6,
    name: '赵军',
    image: '/src/assets/images/login/6.jpg',
    bgColor: '#B0C4DE'
  },
  {
    id: 7,
    name: '周丽',
    image: '/src/assets/images/login/7.jpg',
    bgColor: '#40E0D0'
  },
  {
    id: 8,
    name: '吴磊',
    image: '/src/assets/images/login/8.png',
    bgColor: '#40E0D0'
  }
])

// 计算属性 - 生成环形显示的人才列表
const displayedTalents = computed(() => {
  const result = []
  const totalTalents = talents.value.length
  
  for (let i = 0; i < visibleCount; i++) {
    const actualIndex = (talentCurrentIndex.value - centerIndex.value + i + totalTalents) % totalTalents
    const talent = talents.value[actualIndex]
    result.push({
      ...talent,
      originalIndex: actualIndex
    })
  }
  
  return result
})

// 职位分类数据
const jobCategories = ref([
  { id: 1, name: 'UI设计师', count: 128 },
  { id: 2, name: '现场工程师', count: 95 },
  { id: 3, name: '数据分析师', count: 76 },
  { id: 4, name: '软件工程师', count: 203 },
  { id: 5, name: '销售代表', count: 89 },
  { id: 6, name: '合规管理员', count: 45 },
  { id: 7, name: '客户经理', count: 67 },
  { id: 8, name: '设备维修工程师', count: 34 }
])

// 新标题栏方法
const goToHome = () => {
  activeNav.value = 'home'
  ElMessage.success(t('userHome.alreadyHome'))
}

const goToDemandLibrary = () => {
  activeNav.value = 'demand'
  ElMessage.success(t('userHome.goingToDemandLibrary'))
  router.push('/use/enterprise-demand')
}

const goToApplicationRecords = () => {
  activeNav.value = 'applications'
  ElMessage.success(t('userHome.goingToApplicationRecords'))
  router.push('/profile?tab=applications')
}

const goToNotifications = () => {
  ElMessage.success(t('userHome.goingToNotifications'))
  router.push('/use/messages')
}

const handleDropdownCommand = (command) => {
  switch (command) {
    case 'user-center':
      ElMessage.success(t('userHome.goingToProfile'))
      router.push('/profile')
      break
    case 'logout':
      ElMessage.success(t('userHome.loggedOut'))
      router.push('/login')
      break
  }
}

// 企业端方法
const handleSearch = () => {
  if (searchKeyword.value.trim()) {
    ElMessage.success(t('userHome.searching', { keyword: searchKeyword.value }))
  } else {
    ElMessage.warning(t('userHome.pleaseEnterKeyword'))
  }
}

const showAnnouncementDetail = (announcement) => {
  selectedAnnouncement.value = announcement
  showDetailDialog.value = true
}

const applyNow = (announcement) => {
  ElMessage.success(t('userHome.goingToApply', { title: announcement.title }))
  showDetailDialog.value = false
}

const exploreOpportunities = () => {
  ElMessage.success(t('userHome.startingRecruitment'))
  router.push('/code/enterprise/talent-search')
}

// 人才轮播控制方法
const nextTalent = () => {
  talentCurrentIndex.value = (talentCurrentIndex.value + 1) % talents.value.length
}

const prevTalent = () => {
  talentCurrentIndex.value = (talentCurrentIndex.value - 1 + talents.value.length) % talents.value.length
}

const goToTalent = (targetIndex) => {
  talentCurrentIndex.value = targetIndex
  resetTalentAutoPlay()
}

// 人才轮播自动播放
const startTalentAutoPlay = () => {
  talentAutoPlayTimer = setInterval(() => {
    nextTalent()
  }, 3000)
}

const stopTalentAutoPlay = () => {
  if (talentAutoPlayTimer) {
    clearInterval(talentAutoPlayTimer)
    talentAutoPlayTimer = null
  }
}

const resetTalentAutoPlay = () => {
  stopTalentAutoPlay()
  startTalentAutoPlay()
}

// 职位筛选相关方法
const handleJobCategoryClick = (category) => {
  ElMessage.success(t('userHome.searchingJobs', { category: category.name }))
  router.push({
    path: '/code/enterprise/talent-search',
    query: { 
      category: category.name,
      categoryId: category.id 
    }
  })
}

const viewAllJobs = () => {
  ElMessage.success(t('userHome.loadingAllJobs'))
  router.push('/code/enterprise/talent-search')
}

// 发现人才相关方法
const discoverTalents = () => {
  ElMessage.success(t('userHome.introducingServices'))
  router.push('/code/enterprise/talent-search')
}

// 文化相关方法
const goToProfile = () => {
  ElMessage.success(t('userHome.openingResume'))
  router.push('/profile')
}

const customizeTalentNeeds = () => {
  ElMessage.success(t('userHome.customizingTalentNeeds'))
  // 修改路由，跳转到个人中心的简历页面
  router.push('/profile?tab=resume')
}

// Footer相关方法
const openSocialMedia = (platform) => {
  ElMessage.success(t('userHome.openingPlatform', { platform: platform }))
}

const downloadApp = () => {
  ElMessage.success(t('userHome.goingToWechat'))
}

const visitOfficialWebsite = () => {
  ElMessage.success(t('userHome.goingToWebsite'))
}

const goToPage = (page) => {
  ElMessage.success(t('userHome.goingToPage', { page: page }))
  switch(page) {
    case 'enterprise':
      router.push('/code/enterprise/home')
      break
    case 'student':
      router.push('/xueshengdenglu')
      break
    case 'about':
      router.push('/code/enterprise/info')
      break
    case 'talent':
      router.push('/code/enterprise/talent-search')
      break
  }
}

const scrollToTop = () => {
  window.scrollTo({
    top: 0,
    behavior: 'smooth'
  })
}

// 轮播控制方法
const nextSlide = () => {
  if (currentIndex.value < announcements.value.length - 1) {
    currentIndex.value++
  } else {
    currentIndex.value = 0
  }
}

const prevSlide = () => {
  if (currentIndex.value > 0) {
    currentIndex.value--
  } else {
    currentIndex.value = announcements.value.length - 1
  }
}

const goToSlide = (index) => {
  currentIndex.value = index
  resetAutoPlay()
}

// 自动播放
const startAutoPlay = () => {
  autoPlayTimer = setInterval(() => {
    nextSlide()
  }, 5000)
}

const stopAutoPlay = () => {
  if (autoPlayTimer) {
    clearInterval(autoPlayTimer)
    autoPlayTimer = null
  }
}

const resetAutoPlay = () => {
  stopAutoPlay()
  startAutoPlay()
}

// 轮播图相关状态和方法
const bannerImages = ref([])
const bannerLoading = ref(true)
const bannerError = ref(false)
const currentBannerIndex = ref(0)
let bannerAutoPlayTimer = null


// 获取轮播图数据
const fetchBannerImages = async () => {
  bannerLoading.value = true
  bannerError.value = false
  
  // 检查认证状态
  const token = localStorage.getItem('access_token')
  const userType = localStorage.getItem('user_type')
  const userId = localStorage.getItem('user_id')
  
  console.log('认证状态检查:', {
    hasToken: !!token,
    userType,
    userId,
    tokenLength: token ? token.length : 0
  })
  
  if (!token) {
    console.warn('用户未登录，无法获取轮播图')
    bannerError.value = true
    bannerLoading.value = false
    return
  }
  
  try {
    // 根据用户类型选择不同的接口
    let bannerApiPath = ''
    if (userType === 'admin') {
      bannerApiPath = '/api/api/v1/admin/banner/list'
    } else {
      // 学生和企业用户使用普通接口
      bannerApiPath = '/api/api/v1/admin/banner/list'
    }
    
    console.log('使用的Banner接口:', bannerApiPath, '用户类型:', userType)
    
    // 使用统一的request工具，会自动添加token
    const response = await request.get(bannerApiPath)
    console.log('Banner API response:', response) // 调试输出
    
    if (response && response.success) {
      // 确保数据是数组
      if (Array.isArray(response.data) && response.data.length > 0) {
        // 处理图片URL，确保完整路径
        const baseUrl = import.meta.env.VITE_API_BASE_URL || 'http://localhost:8090'
        bannerImages.value = response.data.map(path => {
          // 如果路径已经是完整URL，直接使用
          if (path.startsWith('http://') || path.startsWith('https://')) {
            return path
          }
          // 生产环境使用baseURL，开发环境使用相对路径
          const isProduction = import.meta.env.PROD
          if (isProduction && config.baseURL) {
            // 生产环境：使用baseURL拼接
            const cleanPath = path.startsWith('/') ? path.slice(1) : path
            return `${config.baseURL}/${cleanPath}`
          } else {
            // 开发环境：使用相对路径，让代理处理
            return path.startsWith('/') ? path : '/' + path
          }
        })
        console.log('处理后的轮播图数据:', bannerImages.value)
      } else {
        console.warn('API返回的轮播图数据为空或格式不正确')
        bannerImages.value = []
      }
    } else {
      console.error('获取轮播图失败:', response?.message || '未知错误')
      bannerImages.value = []
    }
  } catch (error) {
    console.error('获取轮播图出错:', error)
    console.error('错误详情:', {
      status: error.response?.status,
      statusText: error.response?.statusText,
      data: error.response?.data,
      headers: error.response?.headers
    })
    
    // 如果是403错误，尝试使用备用接口
    if (error.response?.status === 403 && userType !== 'admin') {
      console.log('尝试使用备用接口...')
      try {
        const fallbackResponse = await request.get('/api/api/v1/banner/public/list')
        if (fallbackResponse && fallbackResponse.success) {
          console.log('备用接口成功:', fallbackResponse)
          // 处理数据...
          if (Array.isArray(fallbackResponse.data) && fallbackResponse.data.length > 0) {
            const baseUrl = import.meta.env.VITE_API_BASE_URL || 'http://localhost:8090'
            bannerImages.value = fallbackResponse.data.map(path => {
              if (path.startsWith('http://') || path.startsWith('https://')) {
                return path
              }
              // 生产环境使用baseURL，开发环境使用相对路径
              const isProduction = import.meta.env.PROD
              if (isProduction && config.baseURL) {
                const cleanPath = path.startsWith('/') ? path.slice(1) : path
                return `${config.baseURL}/${cleanPath}`
              } else {
                return path.startsWith('/') ? path : '/' + path
              }
            })
            return
          }
        }
      } catch (fallbackError) {
        console.error('备用接口也失败了:', fallbackError)
      }
    }
    
    bannerImages.value = []
  } finally {
    bannerLoading.value = false
  }
}

// 轮播图控制方法
const nextBannerSlide = () => {
  if (currentBannerIndex.value < bannerImages.value.length - 1) {
    currentBannerIndex.value++
  } else {
    currentBannerIndex.value = 0 // 循环到第一个
  }
}

const prevBannerSlide = () => {
  if (currentBannerIndex.value > 0) {
    currentBannerIndex.value--
  } else {
    currentBannerIndex.value = bannerImages.value.length - 1 // 循环到最后一个
  }
}

const goToBannerSlide = (index) => {
  currentBannerIndex.value = index
  resetBannerAutoPlay() // 重置自动播放
}

// 自动播放相关方法
const startBannerAutoPlay = () => {
  bannerAutoPlayTimer = setInterval(() => {
    nextBannerSlide()
  }, 5000) // 每5秒切换
}

const stopBannerAutoPlay = () => {
  if (bannerAutoPlayTimer) {
    clearInterval(bannerAutoPlayTimer)
    bannerAutoPlayTimer = null
  }
}

const resetBannerAutoPlay = () => {
  stopBannerAutoPlay()
  startBannerAutoPlay()
}

// 语言初始化
const initLanguage = () => {
  const savedLang = localStorage.getItem('lang')
  if (savedLang && ['zh', 'en'].includes(savedLang)) {
    locale.value = savedLang
    currentLanguage.value = savedLang
  }
}

// 语言变化事件处理
const handleLanguageChange = (event) => {
  const { language } = event.detail
  // 无需额外处理，因为changeLanguage方法已经更新了locale和currentLanguage
}

onMounted(() => {
  // 初始化语言
  initLanguage()
  
  // 监听语言变化事件
  window.addEventListener('languageChanged', handleLanguageChange)
  
  fetchBannerImages() // 获取轮播图数据
  startBannerAutoPlay() // 启动轮播图自动播放
  startAutoPlay()
  startTalentAutoPlay()
})

onUnmounted(() => {
  // 移除语言变化事件监听器
  window.removeEventListener('languageChanged', handleLanguageChange)
  
  stopBannerAutoPlay() // 停止轮播图自动播放
  stopAutoPlay()
  stopTalentAutoPlay()
})

const enterDemandHub = () => {
  ElMessage.success(t('userHome.enteringDemandHub'))
  router.push('/use/enterprise-demand')
}
</script>

<style scoped>
.user-home-container {
  width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* 语言切换按钮样式 */
.language-switch {
  display: flex;
  align-items: center;
  margin-right: 20px;
  position: absolute;
  top: 15px;
  right: 120px;
  z-index: 1001;
}

.language-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #333;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
  min-width: 100px;
}

.language-dropdown-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.globe-icon {
  font-size: 16px;
  color: #333;
  flex-shrink: 0;
}

.current-lang {
  font-weight: 500;
  flex: 1;
  text-align: left;
}

.arrow-icon {
  font-size: 12px;
  color: #333;
  opacity: 0.8;
  transition: transform 0.3s ease;
}

.language-dropdown-btn:hover .arrow-icon {
  transform: rotate(180deg);
}

/* 语言选项样式 */
.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  width: 100%;
}

.lang-flag {
  font-size: 16px;
  flex-shrink: 0;
}

.lang-text {
  font-size: 14px;
  font-weight: 500;
  flex: 1;
  color: #333;
}

.check-icon {
  font-size: 14px;
  color: #1890ff;
  flex-shrink: 0;
}

/* 活跃状态的下拉项 */
:deep(.el-dropdown-menu__item.is-active) {
  background-color: rgba(24, 144, 255, 0.1);
  color: #1890ff;
}

:deep(.el-dropdown-menu__item.is-active .lang-text) {
  color: #1890ff;
  font-weight: 600;
}

/* 新标题栏样式 */
.header {
  width: 100%;
  height: 64px;
  background: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 1000;
}

.header-container {
  max-width: 1200px;
  height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  padding: 0 20px;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-image {
  width: 40px;
  height: 40px;
}

.logo-text {
  font-family: "华文隶书", "STLiti", serif;
  font-size: 20px;
  font-weight: bold;
  color: #333;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 32px;
  margin-left: auto;
  margin-right: auto;
}

.nav-item {
  font-size: 16px;
  font-weight: 500;
  color: #333;
  cursor: pointer;
  transition: color 0.3s ease;
  padding: 8px 16px;
  border-radius: 4px;
}

.nav-item:hover,
.nav-item.active {
  color: #1890ff;
}

.header-buttons {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* 用户操作按钮样式 */
.user-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.notification-bell {
  color: black;
  cursor: pointer;
  transition: color 0.3s ease;
}

.notification-bell:hover {
  color: #1890ff;
}

.action-item {
  color: black;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.action-item:hover {
  color: #1890ff;
  background: rgba(255, 255, 255, 0.1);
}

/* 企业端样式 */
/* 主横幅区域 */
.hero-section {
  width: 100%;
  height: 100vh;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* 默认背景 - 当没有轮播图时显示 */
.hero-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(133deg, rgba(94,24,160,1) 0%, rgba(4,25,109,1) 53%, rgba(13,0,84,1) 100%);
  z-index: -2;
}

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  max-width: 1200px;
  width: 100%;
  padding: 0 20px;
  position: relative;
  z-index: 10; /* 确保内容在蒙版之上 */
}

.hero-title {
  margin-bottom: 60px;
}

.title-wrapper {
  position: relative;
  display: inline-block;
}

.title-image {
  width: 500px;
  height: 200px;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

/* 整个轮播图区域的蒙版 */
.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.25); /* 半透明黑色蒙板，调整透明度 */
  z-index: 3; /* 确保在轮播图之上，但在内容之下 */
  pointer-events: none; /* 确保点击事件穿透蒙版 */
}

.search-container {
  width: 100%;
  display: flex;
  justify-content: center;
}

.search-box {
  width: 100%;
  max-width: 800px;
  height: 64px;
  background: white;
  border-radius: 32px;
  display: flex;
  align-items: center;
  padding: 8px 8px 8px 24px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
}

.search-input :deep(.el-input__wrapper) {
  border: none;
  box-shadow: none;
  background: transparent;
  padding: 0;
}

.search-button {
  width: 48px;
  height: 48px;
  background: #4A90E2;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

/* 任务和承诺区域样式 */
.mission-section {
  width: 100%;
  padding: 100px 0;
  background: white;
}

.mission-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  text-align: center;
}

.mission-title {
  font-size: 48px;
  font-weight: bold;
  background: linear-gradient(90deg, #1890ff 0%, #722ed1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  margin-bottom: 30px;
  line-height: 1.2;
}

.mission-subtitle {
  font-size: 18px;
  color: #666;
  margin-bottom: 40px;
  font-weight: 500;
}

.mission-description {
  font-size: 16px;
  color: #666;
  line-height: 1.8;
  max-width: 800px;
  margin: 0 auto 50px auto;
  text-align: center;
}

.mission-btn {
  padding: 15px 40px;
  font-size: 16px;
  font-weight: 500;
  border-radius: 25px;
  background: linear-gradient(90deg, #722ed1 0%, #9254de 100%);
  border: none;
  color: white;
  transition: all 0.3s ease;
  box-shadow: 0 4px 16px rgba(114, 46, 209, 0.3);
}

/* 服务特色区域样式 */
.service-features-section {
  width: 100%;
  padding: 80px 0;
  background: #f8f9fa;
}

.service-features-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.service-cards-grid {
  display: flex;
  height: 500px;
  padding: 0 20px;
  gap: 2px;
  /* 允许卡片展开时不受限制 */
  position: relative;
}

/* 当有卡片悬停时，其他卡片缩小 */
.service-cards-grid:hover .service-card:not(:hover) {
  width: 20%;
  transition: all 0.3s ease;
  opacity: 0.7;
}

.service-card {
  position: relative;
  border-radius: 0;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  z-index: 1;
  /* 默认状态下只显示1/3宽度的内容，不是压缩而是裁剪 */
  width: 33.33%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.service-card:hover {
  /* 悬停时适度展开，不完全遮住其他卡片 */
  width: 55%;
  z-index: 10;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  transform: scale(1.02);
  opacity: 1;
}

.card-background {
  position: absolute;
  top: 0;
  left: 0;
  /* 背景应该始终覆盖完整的卡片区域，即使在裁剪状态下 */
  width: 180%;
  height: 100%;
  overflow: hidden;
  transition: all 0.5s ease;
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: left center;
  transition: all 0.5s ease;
}

/* 悬停时背景图像效果 */
.service-card:hover .card-background {
  width: 100%;
}

.service-card:hover .card-image {
  object-position: center;
  filter: brightness(1.1) contrast(1.05);
}

.card-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.1) 100%);
  transition: all 0.3s ease;
}

/* 悬停时覆盖层效果 */
.service-card:hover .card-overlay {
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.05) 100%);
}

.card-content {
  position: relative;
  z-index: 10;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 30px 15px;
  text-align: center;
  transition: all 0.5s ease;
  /* 在裁剪状态下确保内容在可见区域内 */
  width: 100%;
}

/* 悬停时调整内边距 */
.service-card:hover .card-content {
  padding: 30px 20px;
}

.card-title {
  color: black;
  font-size: 22px;
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.8);
  margin-bottom: 15px;
  transition: all 0.3s ease;
  /* 允许文本换行，确保所有文本都能显示 */
  white-space: normal;
  overflow: visible;
}

/* 悬停时标题样式调整 */
.service-card:hover .card-title {
  font-size: 28px;
  text-shadow: 3px 3px 6px rgba(255, 255, 255, 0.9);
  margin-bottom: 20px;
}

.vertical-text {
  writing-mode: vertical-rl;
  text-orientation: upright;
  letter-spacing: 4px; /* 减小字间距，确保长文本能够显示 */
  font-size: 20px; /* 调整字体大小 */
  transition: all 0.3s ease;
  max-height: 300px; /* 确保文本不会超出卡片 */
  overflow: hidden;
}

/* 悬停时垂直文字样式调整 */
.service-card:hover .vertical-text {
  letter-spacing: 6px; /* 减小悬停时的字间距 */
}

.card-description {
  color: black;
  font-size: 14px;
  line-height: 1.4;
  text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
  max-width: 150px; /* 增加宽度，确保英文文本能够显示 */
  writing-mode: horizontal-tb;
  transition: all 0.3s ease;
  /* 在裁剪状态下隐藏描述文本 */
  opacity: 0;
  transform: translateX(-20px);
}

/* 悬停时描述文本样式调整 */
.service-card:hover .card-description {
  font-size: 16px;
  opacity: 1;
  text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.9);
  max-width: 250px; /* 增加悬停时的宽度 */
  transform: translateX(0);
}

/* 公告轮播样式 */
.announcement-section {
  width: 100%;
  padding: 80px 0;
  background: white;
}

.announcement-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.announcement-title {
  font-size: 48px;
  font-weight: bold;
  color: #333;
  margin-bottom: 40px;
  text-align: left;
}

.carousel-wrapper {
  position: relative;
  width: 100%;
}

.carousel-container {
  width: 100%;
  overflow: hidden;
  position: relative;
}

.carousel-track {
  display: flex;
  transition: transform 0.3s ease;
  gap: 40px;
}

.announcement-card {
  display: flex;
  background: white;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  height: 350px;
  width: 800px;
  flex-shrink: 0;
}

.announcement-image {
  width: 400px;
  height: 100%;
  overflow: hidden;
  flex-shrink: 0;
}

.announcement-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.announcement-content {
  flex: 1;
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.announcement-card-title {
  font-size: 24px;
  font-weight: bold;
  color: #333;
  margin-bottom: 20px;
  line-height: 1.4;
}

.announcement-description {
  font-size: 16px;
  color: #666;
  line-height: 1.6;
  margin-bottom: 30px;
  flex: 1;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  -webkit-box-orient: vertical;
}

.learn-more-btn {
  align-self: flex-start;
  padding: 12px 24px;
  border-radius: 25px;
  background: #1890ff;
  border: none;
  color: white;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.carousel-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 30px;
  padding: 0 20px;
}

.carousel-nav {
  display: flex;
  gap: 16px;
}

.nav-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #e0e0e0;
  color: #666;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.carousel-indicators {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ddd;
  cursor: pointer;
  transition: all 0.3s ease;
}

.indicator:hover,
.indicator.active {
  background: #1890ff;
  transform: scale(1.2);
}

/* 全球人才库样式 */
.global-talent-section {
  width: 100%;
  padding: 80px 0;
  background: white;
}

.talent-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.talent-header {
  text-align: center;
  margin-bottom: 60px;
}

.talent-title {
  font-size: 36px;
  font-weight: bold;
  color: #333;
  margin-bottom: 10px;
}

.talent-subtitle {
  font-size: 32px;
  font-weight: bold;
  background: linear-gradient(90deg, #1890ff 0%, #722ed1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  margin: 0;
}

.talent-carousel-wrapper {
  position: relative;
  width: 100%;
}

.talent-carousel-container {
  width: 100%;
  position: relative;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.talent-carousel-track {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  width: 100%;
  position: relative;
}

.talent-card {
  flex-shrink: 0;
  transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.talent-card.is-center {
  transform: scale(1.3);
  z-index: 10;
}

.talent-card.is-center .talent-image-container {
  width: 130px;
  height: 130px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

.talent-card.is-side {
  transform: scale(0.8);
  opacity: 0.7;
  z-index: 5;
}

.talent-card.is-side .talent-image-container {
  width: 100px;
  height: 100px;
}

.talent-card.is-left:first-child,
.talent-card.is-right:last-child {
  transform: scale(0.6);
  opacity: 0.4;
  z-index: 1;
}

.talent-image-container {
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  transition: all 0.5s ease;
  cursor: pointer;
}

.talent-card:hover .talent-image-container {
  transform: scale(1.05);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.talent-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.talent-name {
  margin-top: 12px;
  font-size: 16px;
  font-weight: 600;
  color: #333;
  text-align: center;
  white-space: nowrap;
  background: linear-gradient(90deg, #1890ff 0%, #722ed1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.talent-nav-controls {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 40px;
}

.talent-nav-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: white;
  border: 2px solid #e0e0e0;
  color: #666;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.talent-nav-btn:hover {
  background: #1890ff;
  color: white;
  border-color: #1890ff;
  transform: scale(1.1);
}

/* 职位筛选样式 */
.job-filter-section {
  width: 100%;
  padding: 80px 0;
  background: #f8f9fa;
}

.job-filter-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.job-filter-header {
  text-align: center;
  margin-bottom: 60px;
}

.job-filter-title {
  font-size: 36px;
  font-weight: bold;
  color: #333;
  margin: 0;
}

.highlight-text {
  background: linear-gradient(90deg, #1890ff 0%, #722ed1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.job-categories-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 60px;
}

.job-category-card {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 24px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.job-category-card:hover {
  border-color: #1890ff;
  box-shadow: 0 8px 24px rgba(24, 144, 255, 0.12);
  transform: translateY(-2px);
}

.category-name {
  font-size: 16px;
  font-weight: 500;
  color: #333;
  flex: 1;
}

.category-arrow {
  font-size: 16px;
  color: #999;
  transition: all 0.3s ease;
}

.job-category-card:hover .category-arrow {
  color: #1890ff;
  transform: translateX(4px);
}

.view-all-jobs {
  text-align: center;
}

.view-all-btn {
  padding: 16px 40px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 50px;
  background: linear-gradient(135deg, #1890ff 0%, #722ed1 100%);
  border: none;
  box-shadow: 0 8px 24px rgba(24, 144, 255, 0.3);
  transition: all 0.3s ease;
}

.view-all-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(24, 144, 255, 0.4);
}

.ml-2 {
  margin-left: 8px;
}

/* 发现国际精英样式 */
.discover-talent-section {
  width: 100%;
  padding: 100px 0;
  background: white;
}

.discover-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.discover-content {
  max-width: 800px;
  margin: 0 auto;
  text-align: left;
}

.discover-title {
  font-size: 48px;
  font-weight: bold;
  color: #333;
  line-height: 1.2;
  margin-bottom: 40px;
}

.highlight-blue {
  color: #1890ff;
}

.discover-description {
  margin-bottom: 50px;
}

.desc-text {
    font-size: 16px;
  color: #666;
  line-height: 1.8;
    margin-bottom: 12px;
  text-align: justify;
}

.desc-text:last-child {
  margin-bottom: 0;
}

.discover-action {
  margin-top: 50px;
}

.discover-btn {
  padding: 16px 32px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 50px;
  background: linear-gradient(135deg, #1890ff 0%, #722ed1 100%);
  border: none;
  box-shadow: 0 8px 24px rgba(24, 144, 255, 0.3);
  transition: all 0.3s ease;
  white-space: nowrap;
}

.discover-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(24, 144, 255, 0.4);
}

/* 我们的文化样式 */
.our-culture-section {
  width: 100%;
  padding: 100px 0;
  background: #f8f9fa;
}

.culture-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.culture-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: center;
}

.culture-content {
  padding-right: 40px;
}

.culture-title {
  font-size: 48px;
  font-weight: bold;
  color: #333;
  line-height: 1.2;
  margin-bottom: 40px;
}

.highlight-purple {
  color: #722ed1;
}

.culture-description {
  margin-bottom: 50px;
}

.culture-text {
  font-size: 16px;
  color: #666;
  line-height: 1.8;
  margin-bottom: 8px;
}

.culture-text:last-child {
  margin-bottom: 0;
}

.culture-action {
  margin-top: 50px;
}

.culture-btn {
  padding: 16px 32px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 50px;
  background: linear-gradient(135deg, #722ed1 0%, #1890ff 100%);
  border: none;
  box-shadow: 0 8px 24px rgba(114, 46, 209, 0.3);
  transition: all 0.3s ease;
}

.culture-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(114, 46, 209, 0.4);
}

.culture-images {
  position: relative;
}

.images-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  height: 400px;
}

.image-item {
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  transition: all 0.3s ease;
  cursor: pointer;
}

.image-item:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.team-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: all 0.3s ease;
}

.image-item:hover .team-image {
  transform: scale(1.05);
}

.image-1 {
  grid-row: 1 / 2;
}

.image-2 {
  grid-row: 1 / 2;
}

.image-3 {
  grid-row: 2 / 3;
}

.image-4 {
  grid-row: 2 / 3;
}

/* 我们的承诺样式 */
.our-promise-section {
  width: 100%;
  padding: 100px 0;
  background: white;
  text-align: center;
}

.promise-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.promise-title {
  font-size: 48px;
  font-weight: bold;
  color: #333;
  margin-bottom: 60px;
}

.promise-content {
  max-width: 800px;
  margin: 0 auto;
}

.promise-text {
  font-size: 16px;
  color: #666;
  line-height: 1.8;
  margin-bottom: 8px;
  text-align: center;
}

.promise-highlight {
  font-size: 18px;
  color: #333;
  font-weight: 600;
  line-height: 1.8;
  margin-top: 40px;
  text-align: center;
}

/* Footer样式 */
.main-footer {
  background: #2c2c2c;
  color: white;
  padding: 40px 0 20px;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.footer-content {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 80px;
  align-items: flex-start;
}

.footer-left {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.social-section {
  text-align: left;
}

.follow-text {
  font-size: 14px;
  color: #ccc;
  margin-bottom: 15px;
}

.social-links {
  display: flex;
  gap: 10px;
}

.social-link {
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid #555;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: all 0.3s ease;
}

.social-link.tiktok {
  background: #000;
}

.social-link.wechat {
  background: #1AAD19;
}

.social-link.weibo {
  background: #E6162D;
}

.social-link.qq {
  background: #12B7F5;
}

.social-link:hover {
  transform: scale(1.1);
}

.social-icon-img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.copyright-section {
  margin-top: auto;
}

.copyright-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #999;
}

.copyright-icon {
  font-size: 12px;
}

.footer-center {
  text-align: center;
  min-width: 120px;
}

.contact-title {
  font-size: 16px;
  color: white;
  margin: 0;
  font-weight: 400;
}

.footer-right {
  display: flex;
  align-items: flex-start;
  gap: 40px;
}

.footer-buttons {
  display: flex;
    flex-direction: column;
  gap: 10px;
}

.footer-btn {
  background: #555;
  border: none;
  color: #ccc;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  white-space: nowrap;
  min-width: 120px;
}

.footer-btn:hover {
  background: #666;
  color: white;
}

.sites-section {
  text-align: left;
}

.sites-title {
    font-size: 16px;
  color: white;
  margin-bottom: 15px;
  font-weight: 400;
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.nav-link {
  color: #ccc;
  text-decoration: none;
  font-size: 12px;
  transition: color 0.3s ease;
}

.nav-link:hover {
  color: white;
}

.back-to-top {
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid #666;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.back-to-top:hover {
  background: #555;
  transform: translateY(-2px);
}

/* 弹窗样式 */
.announcement-detail {
  max-height: 70vh;
  overflow-y: auto;
}

.detail-header {
  display: flex;
  align-items: flex-start;
  margin-bottom: 30px;
  gap: 20px;
}

.detail-image {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 12px;
  flex-shrink: 0;
}

.detail-title {
  font-size: 20px;
  font-weight: bold;
  color: #333;
  line-height: 1.4;
  margin: 0;
  flex: 1;
}

.detail-content {
  margin-bottom: 30px;
}

.announcement-full-content h4 {
    font-size: 18px;
  font-weight: bold;
  color: #333;
  margin: 20px 0 10px 0;
  }
  
.announcement-full-content p {
  color: #666;
    line-height: 1.6;
  margin: 10px 0;
}

.detail-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding-top: 20px;
  border-top: 1px solid #eee;
}

/* 轮播图样式 */
.banner-carousel {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1; /* 确保它在其他内容后面 */
  overflow: hidden;
}

.banner-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 1s ease;
  z-index: 1;
}

.banner-slide.active {
  opacity: 1;
  z-index: 2;
}

.banner-indicators {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 15; /* 确保指示器在蒙版之上 */
}

.banner-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.3s ease;
}

.banner-indicator.active {
  background: white;
  transform: scale(1.2);
}

.banner-loading {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(133deg, rgba(94,24,160,0.8) 0%, rgba(4,25,109,0.8) 53%, rgba(13,0,84,0.8) 100%);
  z-index: 1;
}

.loading-icon {
  font-size: 48px;
  color: white;
  animation: rotate 2s linear infinite;
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* 无轮播图提示样式 */
.no-banner-message {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(133deg, rgba(94,24,160,0.9) 0%, rgba(4,25,109,0.9) 53%, rgba(13,0,84,0.9) 100%);
  z-index: 1;
}

.no-banner-message p {
  color: white;
  font-size: 18px;
  font-weight: 500;
  text-align: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  backdrop-filter: blur(10px);
}

</style>
